def chinese_restaurant_process(num_customers, alpha)
    return [] if num_customers <= 0

    table_assignments = [1]
    next_table = 2
    1.upto(num_customers -1) do |i|
        if rand < alpha.to_f / (alpha + i)
            table_assignments << next_table
            next_table += 1
        else
            assign_table = table_assignments[rand(table_assignments.size)]
            table_assignments << assign_table
        end
    end
    table_assignments
end

puts chinese_restaurant_process(num_customers=100, alpha=3).join(",")
